package cn.findviewbydream.evil.main.task;

import cn.findviewbydream.evil.main.service.WebService;
import cn.findviewbydream.evil.main.utils.DataUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.ContextLoader;

import javax.servlet.ServletContext;

/********************************************
 * 工程名：HebeuCS
 * 包名：cn.findviewbydream.evil.main.task
 * 时间：16-12-5
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：自动运行定时任务
 ********************************************/
public class AutoRunaTask
{
    private static Logger logger = LoggerFactory.getLogger(AutoRunaTask.class);

    final private WebService webService;

    @Autowired
    public AutoRunaTask(WebService webService) {this.webService = webService;}

    /**
     * 定时任务::每两小时执行一次，防止mysql8小时错误
     */
    public void autoSelect()
    {
        webService.autoSelect();
    }

    /**
     * 定时任务::每天00:00将访问人数清零
     */
    public void setAccessTimesToZero()
    {
        DataUtil.setAccessTimes(0);
    }

    /**
     * 测试用例
     */
    public void test()
    {
    }
}
